ABC268 C - Chinese Restaurant
提出
code: python
n = int(input())
p = list(map(int, input().split()))
ans = -1
for i in range(n):
tmp = 0
food = p.index(i)
if food == i or food == (i+1)%n or food == (i-1)%n:
tmp += 1
if tmp > ans:
ans = tmp
print(ans)
解答
code: python
n = int(input())
p = list(map(int, input().split()))
# ci := food は i 回まわしたら良い for man, food in enumerate(p):
move = (food - man) % n
print(max(c))
メモ
https://www.youtube.com/watch?v=BYoRvdgI5EU&t=1388s
提出
code: python
n = int(input())
p = list(map(int, input().split()))
# print(mod)
# print(mod)
for idx, v in enumerate(p):
man = idx
food = p.index(idx)
print(man, food)
# mod を算出